#ifndef _PTHREAD_H_
#define _PTHREAD_H_


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<pthread.h>

typedef struct task_node{
	void *arg;
	void *(*fun)(void*);
	pthread_t tid;
	int work_id;
	int flag;
	struct task_node *next;
	pthread_mutex_t node_mutex;
}TASK_NODE_T, *P_TASK_NODE_T;

typedef struct  task_queue{
	pthread_mutex_t task_mutex;
	pthread_cond_t  cond;
	struct task_node *head;
	size_t  size;
}TASK_QUEUE_T, *P_TASK_QUEUE_T;

typedef struct pthread_node{
	pthread_t tid;
	int flag;
	struct task_node *work;
	struct pthread_node *next;
	struct pthread_node *prev;
	pthread_cont_t cond;
	pthread_mutex_t mutext;
}PHTREAD_NODE_T, *PPTHREAD_NODE_T;

typedef struct pthread_queue{
	size_t num;
	struct pthread_node *head;
	struct pthread_node *tail;
	pthread_mutex_t mutex;
	pthread_cont    cont;
}PTHREAD_QUEUE_T, *PPTHREAD_QUEUE_T;




#endif
